package com.menhai.personmanagement.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.menhai.personmanagement.entity.StatisticsOfChronicDiseases;
import com.menhai.personmanagement.entity.co.StatisticsOfChronicDiseasesCo;
import com.menhai.personmanagement.services.StatisticsOfChronicDiseasesService;
import com.menhai.personmanagement.utils.ExportSysStatisticsOfChronicDiseasesInfoExcel;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@RequestMapping("/StatisticsOfChronicDiseases")
public class StatisticsOfChronicDiseasesController {
	@Autowired
	private StatisticsOfChronicDiseasesService StatisticsOfChronicDiseasesService;
	
	/*@RequestMapping("/selectQuery")
	public List<StatisticsOfChronicDiseases> selectQuery (StatisticsOfChronicDiseases StatisticsOfChronicDiseases){
		List<StatisticsOfChronicDiseases> StatisticsOfChronicDiseasesList = new ArrayList<StatisticsOfChronicDiseases>();
		StatisticsOfChronicDiseasesList = StatisticsOfChronicDiseasesService.selectQuery(StatisticsOfChronicDiseases);
        return StatisticsOfChronicDiseasesList;
   }*/

	@RequestMapping("/selectQuery")
    public IPage<StatisticsOfChronicDiseases> login(StatisticsOfChronicDiseasesCo StatisticsOfChronicDiseases){
        IPage<StatisticsOfChronicDiseases> IPage = StatisticsOfChronicDiseasesService.selectQuery(StatisticsOfChronicDiseases);
        return IPage;
    }
	
	@GetMapping("/export")
    public void exports(HttpServletResponse response,StatisticsOfChronicDiseases StatisticsOfChronicDiseases){
        try {
            List<StatisticsOfChronicDiseases> list = StatisticsOfChronicDiseasesService.selectQueryExcel(StatisticsOfChronicDiseases);
            ServletOutputStream out = response.getOutputStream();
            new ExportSysStatisticsOfChronicDiseasesInfoExcel().export(list, out, response);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
